<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
// 路由跳转
const router = useRouter()
const gotoElBaseScrollbar = () => router.push('/element/scrollbar')
// 纵向导航栏
const isCollapse = ref(true)
const handleOpen = (key, keyPath) => {
  console.log(key, keyPath)
}
const handleClose = (key, keyPath) => {
  console.log(key, keyPath)
}
</script>
<template>
  <div class="aside-div">
    <!-- <el-radio-group v-model="isCollapse" style="margin-bottom: 0px">
            <el-radio-button :label="false"></el-radio-button>
            <el-radio-button :label="true"></el-radio-button>
          </el-radio-group> -->
    <el-button
      type="primary"
      @click="isCollapse = !isCollapse"
      style="width: 63.2px; height: 56px"
      >展开</el-button
    >
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :collapse="isCollapse"
      unique-opened="true"
      close-on-click-outside="true"
      text-color="#000000"
      active-text-color="#E11BAA"
      background-color="rgba(233,238,243,0.5)"
    >
      <el-sub-menu index="1">
        <template #title>
          <el-icon><Document /></el-icon>
          <span>基础组件</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="1-1" @click="gotoElBaseScrollbar"
            >滚动条</el-menu-item
          >
          <el-menu-item index="1-2">选项2</el-menu-item>
        </el-menu-item-group>
        <el-sub-menu index="1-4">
          <template #title>选项3</template>
          <el-menu-item index="1-4-1">选项3-1</el-menu-item>
        </el-sub-menu>
      </el-sub-menu>
      <el-menu-item index="2">
        <el-icon><Notebook /></el-icon>
        <template #title>导航二</template>
      </el-menu-item>
      <el-sub-menu index="3">
        <template #title>
          <el-icon><Document /></el-icon>
          <span>导航三</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="3-1">选项1</el-menu-item>
          <el-menu-item index="3-2">选项2</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
    </el-menu>
  </div>
</template>
<style lang="scss" scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 250px;
}
.el-menu {
  border-right: 0;
}
</style>
